/*
环境地址
*/

export function environmentPath() {
  let isInner = true; // 是否内网
  const url = window.location.href;
  console.log(url);
  const arr = [
    // 外网地址
    {
      path: 'https://huatech.htsc.com.cn/maat/',
      title: '生产互联网',
    },
    {
      path: 'http://168.64.10.191:9106/maat/',
      title: '测试互联网1',
    },
    {
      path: 'http://168.64.10.192:9106/maat/',
      title: '测试互联网2',
    },
    {
      path: 'http://168.61.8.70:8080/maat/',
      title: '测试互联网3',
    },
    {
      path: 'http://localhost:8009/',
      title: '本地测试外网',
    },
  ];
  const data = arr.find((item) => {
    return url.indexOf(item.path) > -1;
  });
  isInner = !data;
  console.log('是否是内网：', isInner);

  return isInner;
}
// 获取cid
export function geestcId() {
  let cId = '';
  const url = window.location.href;
  const cids = [
    {
      path: 'https://huatech.htsc.com.cn/maat/',
      title: '生产互联网',
      cId: 'a5d3e5959a482c49bf77f7b8206fea24',
    },
    {
      path: 'http://168.64.10.191:9106/maat/', //
      title: '测试互联网1',
      cId: '16e82c8fef5afbc8f50ae2332c1bc376',
    },
    {
      path: 'http://168.64.10.192:9106/maat/', //
      title: '测试互联网2',
      cId: '16e82c8fef5afbc8f50ae2332c1bc376',
    },
    {
      path: 'http://168.61.8.70:8080/maat/', //
      title: '测试互联网3',
      cId: '16e82c8fef5afbc8f50ae2332c1bc376',
    },
    {
      path: 'http://localhost:8009/',
      title: '本地测试',
      cId: '16e82c8fef5afbc8f50ae2332c1bc376',
    },
  ];
  cids.map((item) => {
    if (url.indexOf(item.path) > -1) cId = item.cId;
  });
  return cId;
}
